
        export function unameCheck(){
            var unamezz =/^([a-zA-Z0-9_\u4e00-\u9fa5]{2,8})$/;
            // 如果验证成功
            if(unamezz.test(this.username)){
                this.userData.uname=this.username;
                this.namespan="√"
                this.isname=true
            }else if(!this.username){
                this.namespan=""
                this.isname=false
            }
            else{
                this.namespan="×"
                this.isname=false
            }
        }

        export function passwordCheck(){
            let reg = /^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{6,16}$/;
            if(reg.test(this.password)){
                this.userData.password=this.password;
                this.passwordspan="√"
                this.ispass=true
            }else if(!this.password){
                this.passwordspan=""
                this.ispass=false
            }
            else{
                this.passwordspan="×"
                this.ispass=false
            }  
        }
        export function phoneCheck(){
            let reg=/^[1][3,4,5,7,8][0-9]{9}$/;
            if(reg.test(this.phone)){
                this.userData.phone=this.phone;
                this.phonespan="√"
                this.isphone=true
            }else if(!this.phone){
                this.phonespan=""
                this.isphone=false
            }
            else{
                this.phonespan="×"
                this.isphone=false
            }  
        }

        export function register(){
            // 获取到输入框的值
            if(this.ischeck){
                if(this.username&&this.password&&this.phone){
                    if(this.isname&&this.isphone&&this.ispass){
                        // 注册逻辑    
                        this.$store.commit('addUser',this.userData)
                    }else if(!this.isname){
                        alert("用户名格式错误！")
                    }else if(!this.ispass){
                        alert("密码格式错误！")
                    }else if(!this.isphone){
                        alert("手机号码错误！")
                    }
                }
                else{
                    alert("请检查信息是否完整")
                }
            }else{
                alert("请先同意服务条款")
            }
            
        }